Dreaddir

Section: Oct. 1, 1991 (2)
Updated: MiNT Programmer's Manual
Index Return to Main Contents
 

NAME

Dreaddir - read directory information  

SYNOPSIS

LONG Dreaddir( WORD len, LONG dirhandle, char *buf);
 

DESCRIPTION

readdir returns the next file in the directory whose handle (from the Dopendir system call) is dirhandle. The file's name and (optionally) a 4 byte index for the file are placed in the buffer pointed to by buf. The file index is omitted if the directory was opened in "compatibility" mode (see Dopendir(2) for details); otherwise, it is placed first in the buffer, followed by the (null terminated) name. If two names have the same index, then they refer to the same file; the converse, however, is not true.

len is the size of the buffer, in total; it should be large enough to hold the index (if any), the file name, and the trailing 0.

Successive calls to Dreaddir will return all the names in the directory, one after another, unless the Drewinddir system call is used to restart the reading at the beginning of the directory.  

RETURNS

0 if successful

ERANGE if the buffer was not large enough to hold the index (if present) and name

ENMFIL if there are no more file names to be read from the directory  

SEE ALSO

Dclosedir(2), Dopendir(2) Drewinddir(2)  

BUGS

Failure to call Dclosedir() when the search is done could result in the system eventually running out of file indices; this is fatal. So always call Dclosedir() when you're finished with the directory search!


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURNS
SEE ALSO
BUGS

This document was created by man2html, using the manual pages.
Time: 16:01:23 GMT, March 03, 2023